Public Class frmCanDoiTaiKhoan
    Private data As DataTable
    Private da As MySqlDataAdapter
    Dim sqlQuery As String

    Private Sub frmCanDoiTaiKhoan_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        moduleUtils.setDinhDangVietNam()
        Dim currentDate As Date = Today
        Dim yyyy As Integer = DatePart(DateInterval.Year, currentDate)
        Dim MM As Integer = DatePart(DateInterval.Month, currentDate)
        Me.txtThang.Text = Format(MM, "00")
        Me.txtNam.Text = yyyy
       
    End Sub

    Private Sub btnInBaoCao_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInBaoCao.Click
        Dim myForm As FrmCrCanDoiTaiKhoan = New FrmCrCanDoiTaiKhoan
        Dim thang As Integer = Me.txtThang.Text.Trim
        myForm.setThang(Format(thang, "00"))
        myForm.setNam(Me.txtNam.Text.Trim)
        myForm.Show()
    End Sub

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        Me.Close()
    End Sub

    Private Sub btnXemCDTK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXemCDTK.Click
        Dim nam As Integer = Me.txtNam.Text.Trim
        Dim thang As Integer = Me.txtThang.Text

        Me.Cursor = Cursors.WaitCursor
        Dim loadTonCDTK As Integer = tonghop.loadTonCDTK(nam, Format(thang, "00"))
        Me.Cursor = Cursors.Default

        If loadTonCDTK = 1 Then
            Dim recycleID As String = nam & Format(thang, "00")
            Dim sqlQuery = "SELECT * FROM tbl_dot_temp_toncdtk WHERE recycleID = '" & recycleID & "' ORDER BY ma_taikhoan"
            Dim record As ArrayList = moduleDatabaseConn.loadDataTable(data, da, sqlQuery)
            da = record.Item(0)
            data = record.Item(1)
            Me.gridTonCDTK.DataSource = data
           
        End If
    End Sub

End Class